@echo off
REM ==========================================================
REM Project - dotnetconn
REM ==========================================================
setlocal

REM ==========================================================
REM Check if JAVA_HOME or BCPSDK_HOME is set and call %root%\setenv.bat
REM ==========================================================
if not defined BCPSDK_HOME	goto :NoBCPSDKFound

call "%~dp0..\..\setenv.bat"

if not defined JAVA_HOME 		goto :NoJavaFound

REM ==========================================================
REM Change the directory context
REM ==========================================================
cd /d "%~dp0"

REM ==========================================================
REM Set required environment variables if any.
REM First check if they are defined in ..\..\setenv.bat
REM ==========================================================
REM set ANT_CP=%JAVA_HOME%\lib\tools.jar;
REM set ANT_CP=%ANT_CP%;%BCPSDK_HOME%\common\buildtasks.jar;

set PATH=%CORDYS_HOME%\bin;%PATH%

REM ==========================================================
REM Invoke ant build
REM ==========================================================
"%JAVA_HOME%\bin\java.exe" -cp "%ANT_CP%" org.apache.tools.ant.Main "-Droot.dir=%BUILD_HOME%" "-Dsdk.dir=%BCPSDK_HOME%" -f test.xml %*
goto :end

REM ==========================================================
REM  If some property is not set, then throw exception
REM ==========================================================
:NoBCPSDK_HOMEFound
echo BCPSDK_HOME environment variable is not set.
goto :end

:NoJavaFound
echo JAVA_HOME environment variable is not set.
goto :end

:end
endlocal